package com.sky.mapper;

import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    void save(List<SetmealDish> list);
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void delete(Long id);
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> byId(Long id);

    @Select("select sd.name, sd.copies, d.image, d.description from setmeal_dish sd left join dish d on sd.dish_id = d.id where sd.setmeal_id = #{id}")
    List<DishItemVO> bySetmealId(Long id);

    List<Long> getSetmealIdByDishIds(List<Long> dishIds);
}
